<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
	<script>
	var a = 'aaa';
	var b = 123;
	var c = true;
	var d = null;
	var e = undefined;
	var f = Symbol('aaa');

	var obj1 = {
		name: 'zhangsan',
		age: 10,
		hobby: ['basketball', 'football'],
		dress: {
			upper: 'T shirt',			
			trousers: 'pants',
			shoes: 'nike'
		}
	};

	function clone(obj){
		var newObj = null;
		
		if(typeof obj == 'object' && obj !== null){
			newObj = obj instanceof Array ? [] : {};
			for(var n in obj){				
				newObj[n] = clone(obj[n]);
			}		
		}else{
			newObj = obj;
		}
	
		return newObj;
	}

	var aaa = clone(obj1);
	console.log(aaa)

	</script>
</body>
</html>